/*
 * Copyright (C) 2008 Wim Crols <twimpiex@gnx.be>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package be.gnx.event.consumer.application.ui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;

public class StatusBar {

  private Text statusText;

  public StatusBar(EventConsumer eventConsumer, Composite parent) {
    createStatusBar(eventConsumer, parent);
  }

  public void createStatusBar(EventConsumer eventConsumer, Composite parent) {
    statusText = new Text(parent, SWT.SINGLE);
    statusText.setText("status bar");
    resize();
  }

  public void resize() {
    Point statusBarSize = statusText.computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
    statusText.setBounds(0, statusText.getParent().getClientArea().height - statusBarSize.y, statusText.getParent().getClientArea().width, statusBarSize.y);
  }

  public int getHeight() {
    return statusText.getSize().y;
  }

}
